﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[CreateProcessPath]
	@processVersionID int,
	@InstanceID int
AS
BEGIN
 

 
	 --creates the empty entries in the history for the current process version
	 insert into InstanceHistories 
		select @InstanceID,null,null,null,StepID,null from Steps 
		where ProcessVersionID= @processVersionID and Type<>'Trigger'


	 select * from InstanceHistories 
	 inner join Steps on steps.StepID = InstanceHistories.StepID
	 where steps.Type = 'start' and steps.ProcessVersionID = @processVersionID
	 	 and InstanceID = @InstanceID
END
